package com.example.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.entity.enums.CouponTypeEnum;
import com.example.entity.enums.PromotionsScopeTypeEnum;
import com.example.entity.enums.UserCouponStatusEnum;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 用户优惠券关联表
 * @TableName user_coupon
 */
@TableName(value ="user_coupon")
@Data
public class UserCoupon implements Serializable {
    /**
     * ID
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 删除标志 true/false 删除/未删除
     */
    @TableField(value = "delete_flag")
    private Boolean deleteFlag;

    /**
     * 更新者
     */
    @TableField(value = "update_by")
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    /**
     * 用户ID
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 优惠券ID
     */
    @TableField(value = "coupon_id")
    private Long couponId;

    /**
     * 领取时间
     */
    @TableField(value = "receive_time")
    private LocalDateTime receiveTime;

    /**
     * 使用时间
     */
    @TableField(value = "use_time")
    private LocalDateTime useTime;

    /**
     * 优惠券状态[0->未使用；1->已使用；2->已过期]
     */
    @TableField(value = "status")
    private UserCouponStatusEnum status;

    /**
     * 订单ID，使用优惠券的订单ID
     */
    @TableField(value = "order_id")
    private Long orderId;

    /**
     * 订单号，使用优惠券的订单号
     */
    @TableField(value = "order_sn")
    private String orderSn;

    /**
     * 优惠券过期时间
     */
    @TableField(value = "end_time")
    private LocalDateTime endTime;

    /**
     * 范围关联的ID
     */
    @TableField(value = "scope_id")
    private Long scopeId;

    /**
     * 关联范围类型:0全品类，1部分商品分类，2部分店铺分类，3指定商品
     */
    @TableField(value = "scope_type")
    private PromotionsScopeTypeEnum scopeType;

    /**
     * 店铺ID
     */
    @TableField(value = "store_id")
    private Long storeId;

    /**
     * 消费门槛
     */
    @TableField(value = "min_point")
    private Integer minPoint;

    /**
     * 折扣值：如果是满减则存满减金额，如果是折扣则存折扣率
     */
    @TableField(value = "reduce_amount")
    private Integer reduceAmount;

    /**
     * 折扣券的最高抵扣金额
     */
    @TableField(value = "max_discount_amount")
    private Integer maxDiscountAmount;

    /**
     * 优惠券分类[0->满减；1->折扣;3-无门槛]
     */
    @TableField(value = "coupon_category")
    private CouponTypeEnum couponCategory;



    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}